package cn.adelyn.blog.file.feign;

import cn.adelyn.blog.api.file.feign.FileFeignClient;
import cn.adelyn.blog.file.constant.MinioConstant;
import cn.adelyn.blog.file.service.FileService;
import cn.adelyn.common.core.response.ServerResponseEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class FileFeignController implements FileFeignClient {

    @Autowired
    FileService fileService;

    @Override
    public ServerResponseEntity deleteFile(List<Long> fileIds) {
        for (Long fileId : fileIds) {
            fileService.deleteFile(MinioConstant.FILE_PATH_PREFIX + MinioConstant.PATH_SEPARATOR + fileId, fileId);
        }
        return ServerResponseEntity.success();
    }

}
